{include file="public/base" /}
{block name="main"}
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>快递发货</h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content">
                    <form method="get" action="javascript:;" class="form-horizontal">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">快递单号</label>
                            <div class="col-sm-10">
                                <input type="text" id="express" value="" class="form-control" style="width:30%;">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">快递公司</label>
                            <div class="col-sm-10">
                                <input type="text" id="courier" value="" class="form-control" style="width:30%;">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-2">
                                <input type="hidden" id="id" value="{$id}">
                                <button class="btn btn-primary" type="submit" onclick="add()">保存内容</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{/block}
{block name="javascript"}
<script src="ADMIN_JS/content.min.js?v=1.0.0"></script>
<script src="ADMIN_JS/plugins/iCheck/icheck.min.js"></script>
<script>
    function add(){
        var express = $("#express").val();
        var courier = $("#courier").val();
        var id = $("#id").val();
        if(express == ''){
            alert('请输入快递单号');
            // layer.msg('',{icon:5,time:1000});
            return false;
        }
        if(courier == ''){
            alert('请输入快递公司');
            // layer.msg('',{icon:5,time:1000});
            return false;
        }
        var formData = new FormData();
        formData.append('express', express);
        formData.append('courier', courier);
        formData.append('id', id);
        $.ajax({
            type: "POST",
            url: '{:url("TaobaoOrder/ordersend")}',
            data : formData,
            contentType: false,
            processData: false,
            success: function (data) {
                if(data.code==1){
                    layer.msg(data.msg,{icon:6,time:1500});
                    setTimeout(function(){window.parent.location.reload();},1000);
                }else{
                    layer.msg(data.msg,{icon:5,time:1500});
                }
            }
        });
    }
</script>
{/block}